<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    document.onclick = function (e) {
            let x = e.pageX;
            let y = e.pageY;
            let tu = document.createElement("div");
            tu.style.width = Math.floor(Math.random() * 200) + "px";
            tu.style.height = tu.style.width;
            let r1=Math.floor(Math.random()*256);
            let r2=Math.floor(Math.random()*256);
            let r3=Math.floor(Math.random()*256);
            tu.style.position = "absolute";
            tu.style.left = x + "px";
            tu.style.top = y + "px";
            tu.style.background ="rgb("+r1+","+r2+","+r3+")";
            document.body.appendChild(tu);
        }
</script>
</body>
</html>